home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 49 / 049.d81 / statistics analy (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  8KB  |  298 lines

  1. 10 gosub10000:         gosub 500
  2. 100 printchr$(142)"[147][158] statistical analyzer      by ian adam"
  3. 110 print"1 -- load data from disk"
  4. 120 print"2 -- create new data file"
  5. 130 print"3 -- save data to disk"
  6. 140 print"4 -- add to data"
  7. 150 print"5 -- edit current data"
  8. 160 print"6 -- change file name"
  9. 170 print"7 -- list data"
  10. 180 print"8 -- analyze data"
  11. 190 print"9 -- view normal distribution (example)"
  12. 200 print"10 - view poison distribution (example)"
  13. 210 print"   (return) - return to loadstar"
  14. 230 if np then print"data function: "df$:print"points:"np
  15. 240 print"up to"mp"points available":print
  16. 250 print"[145]selection :                            [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";
  17. 251 sys32768,2,4,a$:a=val(a$)
  18. 260 ifa<3andnpthenprint"loss of data: ok? :";:sys32768,1,2,a$:ifa$<"y"then100
  19. 270 :
  20. 400 on a+1 gosub 800,1000,2000,1200,2500,3000,1700,4000,5000,8000,8000
  21. 410 goto 100
  22. 420 :
  23. 500 print"[147]":mp=500:dim d(mp):rem max # points
  24. 510 dim cm(40),cl(40),ac(40),pl(40):poke53281,.
  25. 520 def fnl(a)=10^int(log(a)/log(10)-1)
  26. 530 def fnr(x)=l*int(x/l+.95):rem rounding
  27. 540 if peek(48)>9 then cr=679:for i=cr to 697:read s:poke i,s:next:return
  28. 550 data 32,241,183,32,241,183,138,72,32,241,183,138,168,104,170,24,76,240,255
  29. 560 :
  30. 620 :
  31. 800 print"[145] do you wish to quit to loadstar? (y/n)"
  32. 810 geta$:ifa$=""then810
  33. 811 ifa$="y"ora$="[217]"then900
  34. 820 ifa$="n"ora$="[206]"then100
  35. 821 goto 810
  36. 900 open15,8,15,"r0:hello connect=hello connect":input#15,er,er$:close15
  37. 901 ifer<>63 then print"[147]":end
  38. 905 load"hello connect",8,1
  39. 1000 print"[147]load data from disk"
  40. 1010 clr:gosub 500
  41. 1020 d$=",s,r":gosub 1500,open
  42. 1030 if a>19 then run
  43. 1040 :
  44. 1100 input#1,np
  45. 1110 for i=1 to np
  46. 1120 input#1,d(i)
  47. 1130 next:close 1
  48. 1140 gosub 1600:goto 100
  49. 1150 :
  50. 1200 d$=",s,w":print"[147]save data to disk"
  51. 1210 if np=0 then print"no data: press any key";:sys32768,1,128,a$:return
  52. 1220 print"press return for name: "df$
  53. 1230 gosub 1500,open
  54. 1240 if a>19 then return
  55. 1250 :
  56. 1300 print#1,np
  57. 1310 for i=1 to np
  58. 1320 print#1,d(i)
  59. 1330 next:close 1
  60. 1340 goto 1600
  61. 1350 :
  62. 1500 gosub 1700,name :rem open file
  63. 1510 d$="0:"+df$+d$
  64. 1520 close 2:open 2,8,15
  65. 1530 open 1,8,8,d$
  66. 1540 :
  67. 1600 input#2,a,b$:rem error check
  68. 1610 if a<20 then return
  69. 1620 print"problem: "b$:close 1
  70. 1630 if a-63 then print"press any key to continue";:sys32768,1,128,a$:return
  71. 1640 print"replace existing file (y/n):";:sys32768,1,2,a$
  72. 1650 if a$<"y" then return
  73. 1660 print#2,"s0:"+df$:goto 1530
  74. 1670 :
  75. 1700 print"name of file :";:sys32768,14,2,df$:print:rem set name
  76. 1710 if right$(df$,4)<>".sta" then df$=left$(df$,12)+".sta"
  77. 1720 return
  78. 1730 :
  79. 2000 :
  80. 2010 clr:gosub 500
  81. 2020 gosub 1700,name
  82. 2030 gosub 2500:goto 100
  83. 2040 :
  84. 2500 print"[147]enter new data points":print
  85. 2510 print"no negative values":print
  86. 2520 for i=np+1 to mp:print:print"enter value #"i
  87. 2530 print"data (return=quit)";:sys32768,6,12,a$:d(i)=val(a$)
  88. 2531 if a$=""then return
  89. 2540 if d(i)<0 then return
  90. 2550 an=0:np=i:next:return
  91. 2560 :
  92. 3000 print"press (return) or enter 0 to quit.
  93. 3010 :[153]
  94. 3020 p[178]0:[153]"point # to edit (0 quit)";:[158]32768,4,4,p$:p[178][197](p$)
  95. 3030 [139] p[179]1 [176] p[177]np [167] [142]
  96. 3040 [153] [163]5)d(p)
  97. 3050 [153]"ondata :";:[158]32768,6,4,a$:a[178][197](a$):[153]
  98. 3060 [139] d(p)[171]a [167] d(p)[178]a:an[178]0
  99. 3070 [137] 3020
  100. 3080 :
  101. 4000 i[178]1:p[178]21
  102. 4010 [153]"list data: screen or printer s/p? :";:[158]32768,1,2,p$
  103. 4011 [139]p$[178]"p"[167][159]15,4,15:[160]15:[139]st[179][177]0[167][153]"load-printer error-":[137]4010
  104. 4020 [139] p$[178]"p" [167] p[178]np:[159] 4,4:[157] 4
  105. 4030 [153]:[153]"data points for "df$
  106. 4040 :
  107. 4100 [153]"point   data"
  108. 4110 [129] i[178]i [164] i[170]p
  109. 4120 [139] i[177]np [167] 4200
  110. 4130 [153]i [166]6[171][195]([196](i))) d(i)
  111. 4140 [130]
  112. 4150 :
  113. 4200 [139] p$[178]"p" [167] [152]4:[160] 4:[142]
  114. 4210 [153]"press any key to continue.";:[158]32768,1,128,a$:[153]
  115. 4220 [139] i[179]np [167] p[178]22:[137] 4100
  116. 4230 [142]
  117. 4240 :
  118. 5000 [139]np[179]2[167][153]"need more data: press any key.";:[158]32768,2,128,a$:[142]
  119. 5010 [153]"statistics: screen or printer s/p? :";:[158]32768,1,2,p$
  120. 5011 [139]p$[178]"p"[167][159]15,4,15:[160]15:[139]st[179][177]0[167][153]"load-printer error-":[137]5010
  121. 5020 [139] p$[178]"p" [167] [159] 4,4:[157] 4
  122. 5030 [153]:[153]"loaddata analysis":[153]:[153]
  123. 5040 [153]"data function:    "df$
  124. 5050 [153]"number of points:"np
  125. 5060 [139] an [167] 5200:[143] previously analyzed
  126. 5100 mn[178]d(1):mx[178]0:t[178]0:s2[178]0
  127. 5110 [129] i[178]1 [164] np
  128. 5120 t[178]t[170]d(i):s2[178]s2[170]d(i)[172]d(i)
  129. 5130 [139] d(i)[179]mn [167] mn[178]d(i)
  130. 5140 [139] d(i)[177]mx [167] mx[178]d(i)
  131. 5150 [130]
  132. 5160 m[178]t[173]np:[143] mean
  133. 5170 s2[178](s2[171]t[172]t[173]np)[173](np[171]1):[143] variance
  134. 5180 sd[178][186](s2):[143] std deviation
  135. 5190 :
  136. 5200 [153]"loaddata minimum:    "mn
  137. 5210 [153]"data maximum:    "mx
  138. 5220 [153]"range:           "mx[171]mn
  139. 5230 [153]"the mean is:     "m
  140. 5240 [153]"sample variance: "s2
  141. 5250 [153]"std deviation:   "sd
  142. 5260 [153]"coeff variation: "[181](1000[172]sd[173]m)[173]10"%"
  143. 5270 [153]"2/3 interval:"m[171]sd"to"m[170]sd
  144. 5280 [153]"95% interval:"m[171]2[172]sd"to"m[170]2[172]sd
  145. 5290 [139] p$[178]"p" [167] [152]4:[160] 4
  146. 5300 [139] an [167] 6000
  147. 5310 [139] us [167] 5420
  148. 5320 :
  149. 5400 nc[178][181]([186](3[172]np[170]4)):[139] nc[177]33 [167] nc[178]33: [143] set classes
  150. 5410 sp[178](mx[171]mn)[173](nc[171]1):l[178][165]l(sp):cm(1)[178][165]r(mn[171]sp[173]2)
  151. 5420 an[178]1:[141] 6600
  152. 5430 :
  153. 6000 [153]:[153]:[153]"   1 -- see statistics again":[143] analysis menu
  154. 6010 [153]"   2 -- list data by class"
  155. 6020 [153]"   3 -- define classes manually"
  156. 6030 [153]"   4 -- frequency histogram"
  157. 6040 [153]"   5 -- cumulative histogram"
  158. 6050 [153]" return-return to first menu"
  159. 6060 [153]:[153]"your choice :";:[158]32768,1,4,a$:a[178][197](a$):[153]
  160. 6070 [139] a[179]1 [167] [142]
  161. 6080 [145] a [137] 5000
  162. 6090 [145] a[171]1 [141] 9000,6500,7000,7500
  163. 6100 [137] 6000
  164. 6110 :
  165. 6500 us[178]1:[143] manual classes
  166. 6510 [153]"number of classes:"nc
  167. 6520 [153]"the first class starts at";cm(1)
  168. 6530 [153]"class width:"sp
  169. 6540 [153]:[153]"# classes (max 33)";:[158]32768,2,4,nc$:nc[178][197](nc$)
  170. 6550 [139] nc[179]2 [176] nc[177]33 [167] 6510
  171. 6560 [153]"new start:";:[158]32768,6,4,a$:cm(1)[178][197](a$)
  172. 6570 [153]"new width:";:[158]32768,6,4,a$:sp[178][197](a$)
  173. 6580 [139] sp[179][178]0 [167] 6570
  174. 6590 :
  175. 6600 l[178][165]l(sp):mc[178]cm(1)[171]sp:[153]:[153]"working":[143] classes
  176. 6610 [129] i[178]2 [164] nc[170]1
  177. 6620 cm(i)[178][165]r(mc[170]sp[172]i)
  178. 6630 cl(i[171]1)[178]0
  179. 6640 [130]
  180. 6650 :
  181. 6700 [129] i[178]1 [164] np:[143] put data in
  182. 6710 c[178](d(i)[171]mc)[173]sp:[139] c[177]nc [167] c[178]nc
  183. 6720 cl(c)[178]cl(c)[170]1:[130] i
  184. 6730 :
  185. 6800 ac(1)[178]cl(1):[143] accumulation
  186. 6810 [129] i[178]2 [164] nc
  187. 6820 ac(i)[178]ac(i[171]1)[170]cl(i)
  188. 6830 [130]:[142]
  189. 6840 :
  190. 7000 mc[178]0:[143] largest class
  191. 7010 [129] i[178]1 [164] nc
  192. 7020 [139] cl(i)[177]mc [167] mc[178]cl(i)
  193. 7030 [130]
  194. 7040 a[178][165]l(mc):s[178][165]r(mc):sc[178]0:[139]s[177]0[167]sc[178]20[173]s
  195. 7050 :
  196. 7100 [129] i[178]1 [164] nc:[143] scaling
  197. 7110 pl(i)[178]cl(i)[172]sc
  198. 7120 [130]
  199. 7130 a$[178]"frequency distribution "[170]df$
  200. 7140 [137] 7600
  201. 7150 :
  202. 7500 [129] i[178]1 [164] nc:[143] scale accum
  203. 7510 pl(i)[178]ac(i)[172]20[173]np
  204. 7520 [130]
  205. 7530 s[178]100:a$[178]"cumulative frequency "[170]df$
  206. 7540 :
  207. 7600 [153]"load"a$:[153]:[143] graphing routine
  208. 7610 a1$[178][199](207):[129] i[178]0 [164] 32:a1$[178]a1$[170][199](183):[130]
  209. 7620 a2$[178][199](17)[170][199](157)[170][199](165):a2$[178][199](165)[170]a2$[170]a2$
  210. 7630 [129] i[178]5 [164] 1 [169] [171]1
  211. 7640 [153] [202]([196](i[172]s[173]5),2,6)[163]5)a1$
  212. 7650 [153][163]5)a2$:[130]
  213. 7660 [153]"0"[163]5)a1$
  214. 7670 a[178]1[171](nc[179]17):a$[178][196](mx)
  215. 7680 [153] [163]5)mn [163]6[170]a[172]nc[171][195](a$)) a$ [199](150);
  216. 7690 :
  217. 7700 a3$[178][199](146)[170][199](162)
  218. 7710 a4$[178][199](18)[170]" "[170][199](145)[170][199](157)
  219. 7720 [129] i[178]1 [164] nc
  220. 7730 [139] pl(i)[179].1 [167] 7800
  221. 7740 [158] cr,0,22,5[170]a[172]i
  222. 7750 [139] pl(i)[179]1 [167] [153]a3$:[137] 7800
  223. 7760 [129] j[178]1 [